package com.hrp.controller;

import com.hrp.domain.ResponseData;
import com.hrp.domain.TransportRecord;
import com.hrp.domain.UimmsReceiveMoney;
import com.hrp.domain.User;
import com.hrp.service.ReceiveMoneyService;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Created by Administrator on 2019/5/6 0006.
 */
@RestController
@RequestMapping("receiveMoney")
public class ReceiveMoneyController {


    @Autowired
    private ReceiveMoneyService receiveMoneyService;

    @RequestMapping("/getReceiveMoneyRecordByPage")
    public Map<String,Object> getReceiveMoneyRecordByPage(Integer page, Integer rows) {
        return receiveMoneyService.getReceiveMoneyRecordByPage(page,rows);
    }


    @RequestMapping("/saveReceiveMoneyRecordData")
    public ResponseData saveReceiveMoneyRecordData(UimmsReceiveMoney uimmsReceiveMoney) {
        User acount = (User) SecurityUtils.getSubject().getPrincipal();
        uimmsReceiveMoney.setCzry(acount.getUsername());
        return receiveMoneyService.saveReceiveMoneyRecordData(uimmsReceiveMoney);
    }


    @RequestMapping("/getReceiveMoneyDataSummary")
    public Map<String, Object> getReceiveMoneyDataSummary(@RequestParam(name = "sendTimeKsrq", defaultValue = "2018-01-01") String sendTimeKsrq,
                                                   @RequestParam(name = "sendTimeJsrq", defaultValue = "2018-01-01") String sendTimeJsrq,
                                                   @RequestParam(name = "receiverIdStr", defaultValue = "-1") String receiverIdStr) {
        return receiveMoneyService.getReceiveMoneyDataSummary(sendTimeKsrq,sendTimeJsrq,receiverIdStr);
    }

}
